
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%@page import="com.tss.util.*"%>
<%@page import="com.jedi.*"%>
<%@page import="com.store.*"%>
<%@page import="java.util.*"%>
<%@page import="java.text.*"%>
<%@include file="../global_var.jsp"%>
<%@include file="../check_login.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
User just_user = (User)session.getAttribute("LoginUser");
String power_enable_id = "10303";

if (!just_user.hasPower(power_enable_id)) {
	out.println(strNoPowerInfo); 
	return;
}


String nowdate = new SimpleDateFormat("yyyy-mm-MM").format(Calendar.getInstance().getTime());

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">
    
<title>My JSP 'techcontract_add.jsp' starting page</title>
    
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <link href="style/main.css" rel="stylesheet" type="text/css">
	<script language="javascript" src="js/common.js"></script>
	<script language="javascript">
   function clk_goback() {
	history.back();
}
</script>
<%
 String strErr = "";



String cfee     =ParamUtils.getParameter(request,"cfee","0.00");//（手机额度+坐机额度）*人数
String tfee       =ParamUtils.getParameter(request,"tfee","0.00");//市内交通费+招待费
String hfee      =ParamUtils.getParameter(request,"hfee","0.00");//人力资源费（月工资总和*1.3）


String pfee     =ParamUtils.getParameter(request,"pfee","0.00");//（(实际使用笔记本数量*250)
String wfee       =ParamUtils.getParameter(request,"wfee","0.00");//工位分摊+其他 （23000*3）/12


 String cmd = ParamUtils.getParameter(request,"cmd","");
String year = ParamUtils.getParameter(request,"y","0");
String month = ParamUtils.getParameter(request,"m","0");
PalmonthMgr palmonthMgr = new PalmonthMgr();
Palmonth pal= palmonthMgr.get(year,month);

if (pal == null) strErr = "此信息不存在!";
if (!cmd.trim().equals("")) {

 //taskid        = ParamUtils.getParameter(request,"taskid","0");

 //worktime         = ParamUtils.getParameter(request,"worktime","0");
// spartfee      = ParamUtils.getParameter(request,"spartfee","0.00");
 //outefee       = ParamUtils.getParameter(request,"outefee","0.00");
 //tripfee       = ParamUtils.getParameter(request,"tripfee","0.00");
 //month        = ParamUtils.getParameter(request,"month","");
	// year          = ParamUtils.getParameter(request,"year","");     



}

if (cmd.trim().equals("update")) {

	
	
	
	if (strErr.trim().equals("")) {
		try {
			Float.parseFloat(cfee);
		}
		catch(Exception ex) {
			strErr = "（手机额度+坐机额度）*人数 数值输入错误!";
		}
	}
	if (strErr.trim().equals("")) {
		try {
			Float.parseFloat(tfee);
		}
		catch(Exception ex) {
			strErr = "市内交通费+招待费输入错误";
		}
	}
	if (strErr.trim().equals("")) {
		try {
			Float.parseFloat(hfee);
		}
		catch(Exception ex) {
			strErr = "人力资源费输入错误!";
		}
	}

	if (strErr.trim().equals("")) {
		try {
			Float.parseFloat(pfee);
		}
		catch(Exception ex) {
			strErr = "实际使用笔记本数量*250费用输入错误!";
		}
	}
	
		if (strErr.trim().equals("")) {
		try {
			Float.parseFloat(wfee);
		}
		catch(Exception ex) {
			strErr = "工位分摊+其他 （23000*3）/12费用输入错误!";
		}
	}
	if (strErr.trim().equals("")) {
		//pal.setTaskid(Integer.parseInt(taskid));
		//pal.setWorktime( Integer.parseInt(worktime));
		//pal.setSpartfee(Double.parseDouble( spartfee));
		//pal.setOutefee(Double.parseDouble( outefee));
		//pal.setTripfee(Double.parseDouble( tripfee));
	FormatDate formatdate= new FormatDate();
		pal.setY(Integer.parseInt(year));
		pal.setM(Integer.parseInt(month));
		pal.setCreateman(just_user.getId());
		pal.setTfee(Double.parseDouble(tfee));
		pal.setCfee(Double.parseDouble(cfee));
		pal.setHfee(Double.parseDouble(hfee));
		pal.setPfee(Double.parseDouble(pfee));
		pal.setWfee(Double.parseDouble(wfee));
		pal.setCreatetime(formatdate.toDate(nowdate));
		pal.update();
	if (pal.hasErr()) strErr = pal.getErrHtml();
                
	}
}
      if (strErr.trim().equals("")) {
		cfee=FormatNum.formatNumber(pal.getCfee());
		tfee=FormatNum.formatNumber(pal.getTfee());
		pfee=FormatNum.formatNumber(pal.getPfee());
		wfee=FormatNum.formatNumber(pal.getWfee());
		hfee=FormatNum.formatNumber(pal.getHfee());
	    year=pal.getY()+"";
		month=pal.getM()+"";
		}
    %>
   <script language="javascript" >
   function clk_submit() {
	var oForm = document.operatorForm;
	oForm.cmd.value = "update";
	return true;
}

</script>
</head>
<body  leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td >
     <form name="operatorForm" method="post" onSubmit="return clk_submit();">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td height="100" align="center" valign="top" style="padding-top:10px;padding-bottom:10px;">
            <table width="98%" border="0" cellpadding="1" cellspacing="1" bgcolor="#000000">
			

               <%if (!strErr.trim().equals("")) {%>
              <tr> 
                <td height="24" colspan="7" bgcolor="#D7D7DB" style="padding-left:10px;">
                  错误提示：
                 
                  <font color=red><%=strErr%></font>                </td>
              </tr>
              <%}%>
              
              <tr> 
                <td height="24" colspan="7" bgcolor="#858585" style="padding-left:10px;">
                  <font color="#FFFFFF"><strong>损益分析信息</strong></font>  </td>
              </tr>
               <tr>
                   <td width="30%" height="24" align="right" bgcolor="#D7D7DB" style="padding-right:5px;" >通讯费（手机额度+坐机额度）*人数：</td>
                   <td width="70%" colspan="6" bgcolor="#EDEDF0" style="padding-left:5px;" >
                   <input name="cfee" type="text" value="<%=cfee%>" id="outefee" size="25" maxlength="25" > ￥
                  </td>
              </tr> 
              <tr>
                   <td height="24" align="right" bgcolor="#D7D7DB" style="padding-right:5px;" >市内交通费+招待费：</td>
                   <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6" >
                   <input name="tfee" type="text" value="<%=tfee%>" id="tripfee" size="25" maxlength="25" > ￥
                   
                   </td>
              </tr> 
              
               <tr>
                   <td height="24" align="right" bgcolor="#D7D7DB" style="padding-right:5px;" >人力资源费（月工资总和*1.3）：</td>
                   <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6" >
                   <input name="hfee" type="text" value="<%=hfee%>"  size="25" maxlength="25" > ￥
                   
                   </td>
              </tr> 
              <tr>
                   <td height="24" align="right" bgcolor="#D7D7DB" style="padding-right:5px;" >固定资产（实际使用笔记本数量*250）：</td>
                   <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6" >
                   <input name="pfee" type="text" value="<%=pfee%>"  size="25" maxlength="25" > ￥
                   
                   </td>
              </tr> 
                  <tr>
                   <td height="24" align="right" bgcolor="#D7D7DB" style="padding-right:5px;" >工位分摊+其他 （23000*3）/12：</td>
                   <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6" >
                   <input name="wfee" type="text" value="<%=wfee%>"size="25" maxlength="25" > ￥
                   
                   </td>
              </tr> 
                <tr>
                  <td height="24" align="right" bgcolor="#D7D7DB" style="padding-right:5px;"><p>核算年：</p>   
				 </td>
                  <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6">
                  	<%=year%>&nbsp; 年 <%=month%>&nbsp;月
                  
                   <input type="hidden" name="year" value="<%=year%>" class="inputButton" size="10"> 
                 <input type="hidden" name="month" value="<%=month%>" class="inputButton" size="10">  
             </td>
                </tr>
              
              <tr> 
                <td bgcolor="#EDEDF0" colspan="7" align="center">
                  <input type="submit" name="submit" value="保存" class="inputButton"> 
                  <input type="reset" name="reset" value="重写" class="inputButton">    
                    <input type="button" onClick="clk_goback();" name="btn" value="返回" class="inputButton">  
                  <input type="hidden" name="cmd" value="">              
                  </td>
              </tr>
            </table>
          </td>
        </tr>
       
      </table>
      </form>
    </td>
  </tr>
</table>

<%if (cmd.equals("update") && strErr.trim().equals("")){%>
<script language="javascript">
alert("信息修改成功系统将返回首页!");
location.href="palmonthv_list.jsp";
</script>
<%}%>
<iframe width="168" height="190" name="gToday:normal:agenda.js" id="gToday:normal:agenda.js" src="calendar/ipopeng.htm" scrolling="no" frameborder="0"
			style="BORDER-RIGHT:2px ridge; BORDER-TOP:2px ridge; Z-INDEX:999; LEFT:-500px; VISIBILITY:visible; BORDER-LEFT:2px ridge; BORDER-BOTTOM:2px ridge; POSITION:absolute; TOP:0px">
</iframe>
</body>
</html>
